package com.atguigu.controller;

import com.atguigu.entity.HouseUser;
import com.atguigu.service.HouseUserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@RequestMapping("/houseUser")
public class HouseUserController {

    @DubboReference
    private HouseUserService houseUserService;

    /**
     * 跳转到新增页面
     * @param houseId 房源id
     * @param map 将新增数据放到请求域
     * @return 到新增页面
     */
    @RequestMapping("/create")
    public String create(Long houseId,Map map){
        return "houseUser/create";
    }

    @RequestMapping("/save")
    public String save(HouseUser houseUser){
        houseUserService.insert(houseUser);
        return "common/successPage";
    }
}
